﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;

namespace YasharEl.Infrastructure.ResourcesManagement.Configuration
{
    public partial class ResourceProvidersCollection
    {
        private bool HandleUnrecognizedElement(string elementName, XmlReader reader)
        {
            if (elementName == "xmlResourceProvider")
            {
                XmlResourceProviderConfig xmlResourceProvider = new XmlResourceProviderConfig();
                xmlResourceProvider.DeserializeElement(reader);

                BaseAdd(xmlResourceProvider);

                return true;
            }

            //if (elementName == "binaryResourceProvider")
            //{
            //    BinaryResourceProviderConfig binaryResourceProvider = new BinaryResourceProviderConfig();
            //    binaryResourceProvider.DeserializeElement(reader);

            //    BaseAdd(binaryResourceProvider);

            //    return true;
            //}

            if (elementName == "databaseResourceProvider")
            {
                DatabaseResourceProviderConfig databaseResourceProvider = new DatabaseResourceProviderConfig();
                databaseResourceProvider.DeserializeElement(reader);

                BaseAdd(databaseResourceProvider);

                return true;
            }

            if (elementName == "assemblyResourceProvider")
            {
                AssemblyResourceProviderConfig assemblyResourceProvider = new AssemblyResourceProviderConfig();
                assemblyResourceProvider.DeserializeElement(reader);

                BaseAdd(assemblyResourceProvider);

                return true;
            }

            return false;
        }
    }
}
